{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# def get_index(start_url):\n",
    "#     #获取当前页面的html\n",
    "#     response = requests.get(start_url).text   \n",
    "#     doc = pq(response)\n",
    "#     #获取当前字体文件名称\n",
    "#     classattr = doc('p.update > span > span').attr('class')\n",
    "#     pattern = '</style><span.*?%s.*?>(.*?)</span>'%classattr\n",
    "#     #获取当前页面所有被字数字符\n",
    "#     numberlist = re.findall(pattern,response)\n",
    "#     #获取当前包含字体文件链接的文本\n",
    "#     fonturl = doc('p.update > span > style').text() \n",
    "#     #通过正则获取当前页面字体文件链接\n",
    "#     url = re.search('woff.*?url.*?\\'(.+?)\\'.*?truetype',fonturl) .group(1)\n",
    "#     cmap = get_font(url)\n",
    "#     books = doc('.all-img-list li').items()\n",
    "#     i = 0\n",
    "#     for book in books:\n",
    "#         item = {}\n",
    "#         item['img'] = 'http:' + book('.book-img-box a img').attr('src')\n",
    "#         item['bookname'] = book('.book-mid-info h4 a').text()\n",
    "#         item['author'] = book('.name').text()\n",
    "#         item['classes'] = book('p.author > a:nth-child(4)').text()\n",
    "#         item['content'] = book('.intro').text()\n",
    "#         item['number'] = get_encode(cmap,numberlist[i][:-1])\n",
    "#         i += 1\n",
    "\n",
    "\n",
    "\n",
    "# def get_encode(cmap,values):\n",
    "#     WORD_MAP = {'zero':'0','one':'1','two':'2','three':'3','four':'4','five':'5','six':'6','seven':'7','eight':'8','nine':'9','period':'.'}\n",
    "#     word_count=''\n",
    "#     for value in values.split(';'):\n",
    "#         value = value[2:]\n",
    "#         key = cmap[int(value)]\n",
    "#         word_count += WORD_MAP[key]\n",
    "#     return word_count\n",
    "\n",
    "\n",
    "# def get_font(url):\n",
    "#     response = requests.get(url)\n",
    "#     font = TTFont(BytesIO(response.content))\n",
    "#     cmap = font.getBestCmap()\n",
    "#     font.close()\n",
    "#     return cmap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyquery import PyQuery as pq\n",
    "import requests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "start_urls = \"https://www.qidian.com/all?orderId=3&page=1&style=2&pageSize=50&siteid=1&pubflag=0&hiddenField=0\"\n",
    "r = requests.get(start_urls)\n",
    "resp = r.text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "doc1 = pq(resp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<html>]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "doc1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "starturl = \"https://www.qidian.com/finish?action=hidden&orderId=3&page=1&style=1&pageSize=20&siteid=1&pubflag=0&hiddenField=2\"\n",
    "r1 = requests.get(starturl).text\n",
    "doc = pq(r1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "books = doc('.all-img-list li').items()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<generator object PyQuery.items at 0x7fd8b468a390>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "books"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "import re\n",
    "classattr = doc('p.update > span > span').attr('class')\n",
    "pattern = '</style><span.*?%s.*?>(.*?)</span>'%classattr\n",
    "numberlist = re.findall(pattern,r1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'FmrnGAfQ'"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "doc('p.update > span > span').attr('class')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>, <span.FmrnGAfQ>]"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "doc('p.update > span > span')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "&#100441;&#100444;&#100446;&#100438;&#100445;&#100439;&#100443;\n",
      "&#100446;&#100443;&#100442;&#100442;&#100445;&#100436;&#100447;\n",
      "&#100446;&#100441;&#100447;&#100446;&#100445;&#100441;&#100447;\n",
      "&#100446;&#100446;&#100447;&#100442;&#100445;&#100444;&#100442;\n",
      "&#100446;&#100446;&#100447;&#100444;&#100445;&#100438;&#100438;\n",
      "&#100446;&#100446;&#100439;&#100447;&#100445;&#100440;&#100439;\n",
      "&#100446;&#100446;&#100444;&#100440;&#100445;&#100441;&#100439;\n",
      "&#100446;&#100444;&#100440;&#100444;&#100445;&#100441;&#100441;\n",
      "&#100446;&#100444;&#100439;&#100436;&#100445;&#100447;&#100442;\n",
      "&#100446;&#100444;&#100446;&#100438;&#100445;&#100443;&#100442;\n",
      "&#100446;&#100444;&#100446;&#100446;&#100445;&#100446;&#100447;\n",
      "&#100438;&#100438;&#100440;&#100445;&#100442;&#100447;\n",
      "&#100438;&#100442;&#100442;&#100445;&#100447;&#100442;\n",
      "&#100438;&#100436;&#100442;&#100445;&#100447;\n",
      "&#100438;&#100447;&#100446;&#100445;&#100444;&#100446;\n",
      "&#100438;&#100446;&#100447;&#100445;&#100438;&#100441;\n",
      "&#100438;&#100444;&#100441;&#100445;&#100441;&#100439;\n",
      "&#100442;&#100438;&#100442;&#100445;&#100447;&#100438;\n",
      "&#100442;&#100438;&#100444;&#100445;&#100441;&#100439;\n",
      "&#100442;&#100439;&#100447;&#100445;&#100440;&#100447;\n"
     ]
    }
   ],
   "source": [
    "for ii in numberlist:\n",
    "    print(ii)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#maybe avilable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#needs to slove"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "#example\n",
    "ca = doc1('tr .total span').attr('class')\n",
    "pat = '</style><span.*?%s.*?>(.*?)</span>'%ca\n",
    "nl = re.findall(pat,resp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "&#100538;&#100530;&#100530;&#100527;&#100533;&#100527;&#100537;\n",
      "\n",
      "&#100538;&#100534;&#100532;&#100531;&#100533;&#100535;&#100538;\n",
      "\n",
      "&#100538;&#100534;&#100537;&#100536;&#100533;&#100529;&#100535;\n",
      "\n",
      "&#100537;&#100530;&#100531;&#100529;&#100533;&#100536;&#100538;\n",
      "\n",
      "&#100537;&#100535;&#100527;&#100527;&#100533;&#100530;&#100532;\n",
      "\n",
      "&#100537;&#100531;&#100532;&#100536;\n",
      "\n",
      "&#100537;&#100531;&#100532;&#100537;&#100533;&#100529;&#100532;\n",
      "\n",
      "&#100537;&#100531;&#100531;&#100535;&#100533;&#100532;&#100527;\n",
      "\n",
      "&#100537;&#100529;&#100529;&#100534;&#100533;&#100538;&#100530;\n",
      "\n",
      "&#100537;&#100529;&#100538;&#100536;&#100533;&#100535;&#100536;\n",
      "\n",
      "&#100537;&#100529;&#100537;&#100531;&#100533;&#100532;&#100535;\n",
      "\n",
      "&#100537;&#100538;&#100532;&#100537;&#100533;&#100538;&#100532;\n",
      "\n",
      "&#100537;&#100538;&#100534;&#100529;&#100533;&#100527;&#100538;\n",
      "\n",
      "&#100537;&#100538;&#100534;&#100537;&#100533;&#100530;&#100532;\n",
      "\n",
      "&#100537;&#100537;&#100536;&#100530;&#100533;&#100532;&#100532;\n",
      "\n",
      "&#100537;&#100537;&#100532;&#100527;&#100533;&#100534;&#100527;\n",
      "\n",
      "&#100537;&#100537;&#100532;&#100534;&#100533;&#100536;&#100536;\n",
      "\n",
      "&#100537;&#100537;&#100529;&#100532;&#100533;&#100531;&#100529;\n",
      "\n",
      "&#100537;&#100537;&#100534;&#100531;&#100533;&#100538;&#100529;\n",
      "\n",
      "&#100537;&#100534;&#100536;&#100530;&#100533;&#100535;&#100538;\n",
      "\n",
      "&#100537;&#100534;&#100536;&#100531;&#100533;&#100532;\n",
      "\n",
      "&#100537;&#100534;&#100532;&#100531;&#100533;&#100535;&#100535;\n",
      "\n",
      "&#100537;&#100534;&#100531;&#100534;&#100533;&#100538;&#100538;\n",
      "\n",
      "&#100537;&#100534;&#100529;&#100530;&#100533;&#100532;&#100527;\n",
      "\n",
      "&#100537;&#100534;&#100529;&#100531;\n",
      "\n",
      "&#100537;&#100534;&#100537;&#100536;&#100533;&#100535;&#100527;\n",
      "\n",
      "&#100537;&#100534;&#100537;&#100531;&#100533;&#100527;\n",
      "\n",
      "&#100537;&#100534;&#100537;&#100529;&#100533;&#100532;&#100538;\n",
      "\n",
      "&#100537;&#100534;&#100537;&#100537;&#100533;&#100537;&#100532;\n",
      "\n",
      "&#100537;&#100534;&#100534;&#100534;&#100533;&#100534;&#100529;\n",
      "\n",
      "&#100536;&#100536;&#100531;&#100533;&#100527;&#100532;\n",
      "\n",
      "&#100536;&#100536;&#100538;&#100533;&#100531;&#100529;\n",
      "\n",
      "&#100536;&#100527;&#100527;&#100533;&#100536;&#100536;\n",
      "\n",
      "&#100536;&#100527;&#100527;&#100533;&#100532;&#100527;\n",
      "\n",
      "&#100536;&#100530;&#100536;&#100533;&#100535;&#100532;\n",
      "\n",
      "&#100536;&#100530;&#100527;&#100533;&#100532;\n",
      "\n",
      "&#100536;&#100530;&#100530;&#100533;&#100532;&#100532;\n",
      "\n",
      "&#100536;&#100530;&#100538;&#100533;&#100534;&#100527;\n",
      "\n",
      "&#100536;&#100530;&#100534;&#100533;&#100536;&#100527;\n",
      "\n",
      "&#100536;&#100532;&#100537;&#100533;&#100534;&#100537;\n",
      "\n",
      "&#100536;&#100535;&#100532;&#100533;&#100537;&#100532;\n",
      "\n",
      "&#100536;&#100535;&#100531;&#100533;&#100532;&#100532;\n",
      "\n",
      "&#100536;&#100531;&#100535;&#100533;&#100538;&#100531;\n",
      "\n",
      "&#100536;&#100531;&#100531;&#100533;&#100530;&#100536;\n",
      "\n",
      "&#100536;&#100531;&#100529;&#100533;&#100537;&#100537;\n",
      "\n",
      "&#100536;&#100529;&#100530;&#100533;&#100536;&#100535;\n",
      "\n",
      "&#100536;&#100538;&#100530;&#100533;&#100531;&#100531;\n",
      "\n",
      "&#100536;&#100537;&#100532;&#100533;&#100536;&#100538;\n",
      "\n",
      "&#100536;&#100534;&#100529;&#100533;&#100532;&#100531;\n",
      "\n",
      "&#100536;&#100534;&#100538;&#100533;&#100538;&#100529;\n",
      "\n"
     ]
    }
   ],
   "source": [
    "for i in nl:\n",
    "    print(i)\n",
    "    print(\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'&#100538;&#100530;&#100530;&#100527;&#100533;&#100527;&#100537'"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nl[0][:-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'&#100538;&#100530;&#100530;&#100527;&#100533;&#100527;&#100537;'"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nl[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['&#100538',\n",
       " '&#100530',\n",
       " '&#100530',\n",
       " '&#100527',\n",
       " '&#100533',\n",
       " '&#100527',\n",
       " '&#100537']"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nl[0][:-1].split(';')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['&#100538',\n",
       " '&#100530',\n",
       " '&#100530',\n",
       " '&#100527',\n",
       " '&#100533',\n",
       " '&#100527',\n",
       " '&#100537',\n",
       " '']"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nl[0].split(';')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 多一个空行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 获取字体的url信息，这里采用了正则表达式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [],
   "source": [
    "fonturl = doc('p.update > span > style').text() \n",
    "url = re.search('woff.*?url.*?\\'(.+?)\\'.*?truetype',fonturl) .group(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"@font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: FmrnGAfQ; src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf') format('truetype'); } .FmrnGAfQ { font-family: 'FmrnGAfQ' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; }\""
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fonturl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'https://qidian.gtimg.com/qd_anti_spider/FmrnGAfQ.ttf'"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "url"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "fu = doc1('tr .total style').text()\n",
    "u = re.search('woff.*?url.*?\\'(.+?)\\'.*?truetype',fu) .group(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"@font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; } @font-face { font-family: GQdJFHsj; src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.eot?') format('eot'); src: url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.woff') format('woff'), url('https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf') format('truetype'); } .GQdJFHsj { font-family: 'GQdJFHsj' !important; display: initial !important; color: inherit !important; vertical-align: initial !important; }\""
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fu"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'https://qidian.gtimg.com/qd_anti_spider/GQdJFHsj.ttf'"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# how to use mongoDB?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pymongo\n",
    "client = pymongo.MongoClient('127.0.0.1')\n",
    "db = client.qidian\n",
    "p  = db.finish\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [],
   "source": [
    "def mongo(item):\n",
    "    p.insert(item)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 确定标签的选择问题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [],
   "source": [
    "for book in books:\n",
    "    item = {}\n",
    "    item['bookname'] = book('.book-mid-info h4 a').text()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'bookname': '最强兵王'}"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "item"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "tbook = doc1('tbody > tr').items()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<generator object PyQuery.items at 0x7fd8b4486b10>\n"
     ]
    }
   ],
   "source": [
    "print(tbook)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "for tb in tbook:\n",
    "    tf = {}\n",
    "    tf['类别'] = tb('.td-one').text()\n",
    "    tf['小说书名'] = tb('.name').text()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2014-11-30'"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tb('.date').text()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
